package com.youyi.yyviewsdklibrary;

import android.content.Context;
import android.content.DialogInterface;

public class LoadingDialogOld {
    private static BaseLoadDialog loadingDialog;

    public static void show(Context context) {
        try {
            if (loadingDialog != null) {
                loadingDialog = null;
            }
            BaseLoadDialog baseLoadDialog = new BaseLoadDialog(context);
            loadingDialog = baseLoadDialog;
            baseLoadDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
                /* class com.youyi.yyviewsdklibrary.LoadingDialogOld.AnonymousClass1 */

                public void onCancel(DialogInterface dialogInterface) {
                    LoadingDialogOld.hidden();
                }
            });
            loadingDialog.show();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void show(Context context, String str) {
        try {
            if (loadingDialog != null) {
                loadingDialog = null;
            }
            loadingDialog = new BaseLoadDialog(context);
            BaseLoadDialog.SetText(str);
            loadingDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
                /* class com.youyi.yyviewsdklibrary.LoadingDialogOld.AnonymousClass2 */

                public void onCancel(DialogInterface dialogInterface) {
                    LoadingDialogOld.hidden();
                }
            });
            loadingDialog.show();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void hidden() {
        try {
            BaseLoadDialog baseLoadDialog = loadingDialog;
            if (baseLoadDialog != null) {
                baseLoadDialog.dismiss();
                BaseLoadDialog.setTextViewNull();
                loadingDialog = null;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
